package com.twd.allcomponent.i18n.controller;

import com.twd.allcomponent.i18n.config.CustomMessageSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MyController {
    @Autowired
    private RedisTemplate redisTemplate;
//    @Autowired
    private CustomMessageSource customMessageSource;
    @GetMapping("test")
    public String getRedisTest(){
        String msg1 = customMessageSource.getMessage("400",new Object[]{1,3}, LocaleContextHolder.getLocale());
        String msg2 = customMessageSource.getMessage("400", new Object[]{1,3}, LocaleContextHolder.getLocale());
        return msg1+"\n"+msg2;
    }

}
